#ifndef __PE_Detect_C
#define __PE_Detect_C

#include "PE_Detect.h"

void PE_Detect_init(){
    GPIO_Config_T     configStruct;
	
    RCM_EnableAPB2PeriphClock(PE_RTC);
    /* Configure Button pin as input floating */
	  #if PE_method == PE_method_ADC
	  configStruct.mode = GPIO_MODE_ANALOG; // ADC采样    
	  #else
	  configStruct.mode = GPIO_MODE_IN_FLOATING; //浮空输入
	  #endif
    configStruct.pin  = PE_PinId;
	  
    GPIO_Config(PE_PinPort, &configStruct);  
	  
}


uint8_t PE_get_level(){
	  //printf(" %d ",ADC_Buffer.ADC_Item.ADCValue_PE);
    #if PE_method == PE_method_ADC
	  return (ADC_Buffer.ADC_Item.ADCValue_PE > (PE_ADC_Value + PE_VoltRest));
    #else
	  return GPIO_ReadInputBit(PE_PinPort, PE_PinId);
    #endif	
	  
}


#endif
